import java.util.List;
import java.util.Map;

/**
 * @Author: zyf
 * @Date: 2024/04/25/15:10
 * @Description:
 */
public class Result {

    private final String message;
    private final boolean isSuccess;
    private final Object data;

    private Result(String message, boolean isSuccess, Object data) {
        this.message = message;
        this.isSuccess = isSuccess;
        this.data = data;
    }

    public static Result success(String message, Object data) {
        return new Result(message, true, data);
    }

    public static Result error(String message, Object data) {
        return new Result(message, false, data);
    }

    public String getMessage() {
        return message;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public Object getData() {
        return data;
    }

    @Override
    public String toString() {
        return "Result{" +
                "\n message=" + message +
                "\n isSuccess=" + isSuccess +
                "\n data=" + ToStringUtil.object2string(1, data) +
                "}";
    }


}
